package com.linjuke.water.core.dal.ibatis;

import java.util.List;

import com.linjuke.water.common.domains.CategoryDO;
import com.linjuke.water.core.dal.datainterface.CategoryDAO;

public class CategoryDAOIbatis extends BaseIbatisDAO implements CategoryDAO {

	@Override
	public int create(CategoryDO categoryDO) {
		return (Integer)this.getSqlMapClientTemplate().insert("CategoryDAO.create", categoryDO);
	}

	@Override
	public void delete(int id) {
		getSqlMapClientTemplate().update("CategoryDAO.delete", id);
	}

	@Override
	public void update(CategoryDO categoryDO) {
		getSqlMapClientTemplate().update("CategoryDAO.update", categoryDO);
	}

	@Override
	public CategoryDO queryById(int id) {
		return (CategoryDO)getSqlMapClientTemplate().queryForObject("CategoryDAO.queryById", id);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<CategoryDO> listAll() {
		return (List<CategoryDO>)getSqlMapClientTemplate().queryForList("CategoryDAO.listAll");
	}

}
